using MediatR;
using S.M.SmartMedical.Domain.DTOs;
using S.M.SmartMedical.ErrorCode;

namespace S.M.SmartMedical.API.Write.Application.Command
{
    /// <summary>
    /// 创建医院命令对象
    /// 用于处理医院创建请求
    /// </summary>
    public class CreateHospitalCommand : IRequest<APIResult<HospitalDto>>
    {
        /// <summary>
        /// 医院名称
        /// </summary>
        public string Name { get; set; } = string.Empty;

        /// <summary>
        /// 医院图片URL
        /// </summary>
        public string ImageUrl { get; set; } = string.Empty;

        /// <summary>
        /// 医院等级
        /// </summary>
        public string Level { get; set; } = string.Empty;

        /// <summary>
        /// 医院类型
        /// </summary>
        public string Type { get; set; } = string.Empty;

        /// <summary>
        /// 医院地址
        /// </summary>
        public string Address { get; set; } = string.Empty;

        /// <summary>
        /// 联系电话
        /// </summary>
        public string Phone { get; set; } = string.Empty;

        /// <summary>
        /// 医院描述
        /// </summary>
        public string Description { get; set; } = string.Empty;

        /// <summary>
        /// 是否启用
        /// </summary>
        public bool IsEnabled { get; set; } = true;

        /// <summary>
        /// 上传人
        /// </summary>
        public string Uploader { get; set; } = string.Empty;

        /// <summary>
        /// 构造函数
        /// </summary>
        public CreateHospitalCommand()
        {
        }

        /// <summary>
        /// 构造函数，从创建DTO初始化
        /// </summary>
        /// <param name="createDto">医院创建DTO</param>
        /// <param name="uploader">上传人</param>
        public CreateHospitalCommand(HospitalCreateDto createDto, string uploader)
        {
            Name = createDto.Name;
            ImageUrl = createDto.ImageUrl;
            Level = createDto.Level;
            Type = createDto.Type;
            Address = createDto.Address;
            Phone = createDto.Phone;
            Description = createDto.Description;
            IsEnabled = createDto.IsEnabled;
            Uploader = uploader;
        }
    }
}